package com.start.shop.modules.repository.entity;

import java.util.Date;

import com.start.shop.common.constant.SysConstants;
import com.start.shop.common.weixin.domain.WxUserInfo;

import lombok.Data;

@Data
public class User {
	private int userId         ;       //序号      
	private String userName     ;      //用户ID    
	private String password   ;       //用户密码  
	private String nickName   ;      //用户名    
	private String openId     ;      //微信OPENID
	private String unionId     ;      //微信OPENID
	private int sex;                //性别      
	private String city       ;       //城市      
	private String province   ;       //省份      
	private String headImgUrl ;     //头像      
	private String phone    ;      //用户手机    
	private int    status     ;       //状态   
	private int    auth;             //授权状态  1授权  0 未授权
	private String fromChannel;      //引入渠道  
	private int agentId;       //代理人userid   
	private int    drawTimes;
	private Date   createTime;
	private String token;
	
	public static User setData(WxUserInfo wxUserInfo) {
		User user = new User();
		user.setNickName(wxUserInfo.getNickName());
		user.setOpenId(wxUserInfo.getOpenId());
		user.setSex(wxUserInfo.getGender());
		user.setProvince(wxUserInfo.getProvince());
		user.setCity(wxUserInfo.getCity());
		user.setHeadImgUrl(wxUserInfo.getAvatarUrl());
		user.setStatus(SysConstants.UserStatus.Nomal);
		return user;
	}
}
